<template>
  <div>
    <breade-com :breadList="breadList"></breade-com>
    <student-form></student-form>
    <student-table :count="count" :stuList="stuList"></student-table>
  </div>
</template>
<script>
import studentForm from './studentForm.vue'
import studentTable from './studentTable.vue'
import breadeCom from '../../components/breade.vue'
import { _getStudent } from '../../api/student'
export default {
  components: { studentForm, studentTable, breadeCom },
  created () {
    this.getStudent()
  },
  data () {
    return {
      pageStart: 1,
      breadList: [
        {
          title: '人员管理',
          path: '/'
        },
        {
          title: '学员管理',
          path: '/'
        }
      ],
      // 用来查询的数据
      userName: '',
      phone: '',
      email: '',
      count: 0, //学员总数据条数
      stuList: [] //学员列表数据
    }
  },
  methods: {
    // 获取学员列表
    async getStudent () {
      // 获取学员列表接口
      var res = await _getStudent({
        pageStart: this.pageStart, //分页
        userName: this.userName, //查询需要的姓名
        phone: this.phone, //查询需要的手机号
        email: this.email //查询需要的邮箱
      })
      console.log(res)
      this.count = res.data.count
      this.stuList = res.data.list
    }
  }
}
</script>
